{% extends 'mould/auto.html' %}
{% csrf_token %}

{% block title %}
  DomainTrade-login
{% endblock %}

{% block body %}
  <div class="account-pages">
    <div class="wrapper-page">
      <div class="text-center">
        <a href="/index" class="logo"><span>DoaminTrade<span>to</span></span></a>
      </div>
      <div class="m-t-40 card-box">
        <div class="text-center">
          <h4 class="text-uppercase font-bold m-b-0">登录</h4>
        </div>
        <div class="panel-body">
          <form class="am-form" action="/signin" method="POST">
            {% csrf_token %}
            <div class="am-g">
              <div class="am-form-group">
                <label for="username">用户名 <span
                        style="color: red; text-align: center; margin: 65px;"><i>{{ msg_tag }}</i></span></label>
                <input id="username" type="email" class="am-radius" name='email' placeholder="邮箱">
              </div>

              <div class="am-form-group form-horizontal m-t-20">
                <label for="passwd">密码</label>
                <input id='passwd' type="password" size=6 class="am-radius" name="passwd"
                       placeholder="密码">
              </div>
              <div class="form-group">
                <label for="check">验证码</label>
                <div class="row">
                  <div class="col-xs-7">
                    <input id='check' style="width: 160px;display: inline;" type="text"
                           class="form-control" size=4 placeholder="请输入验证码" name="check_code">
                    <img style="margin: 10px;" src="/check_code.html"
                         onclick="changeCheckCode(this);">
                  </div>
                </div>
              </div>

              <div class="am-form-group" style="line-height: 60px;">
                <button type="submit" class="am-btn am-btn-primary am-radius"
                        style="width: 100%;height: 100%;">登录
                </button>
              </div>

              <div class="am-form-group ">
                <a href="/repasswd" class="text-muted"><i class="fa fa-lock m-r-5"></i>忘记密码?</a>
                <a style="float: right" href="/signup" class="text-muted"><i
                        class="fa fa-lock m-r-5"></i>注册</a>
              </div>
            </div>

          </form>

        </div>
      </div>
    </div>
  </div>
   <script src="/static/js/jquery.min.js"></script>
  <script src="/static/js/jquery.cookie.js"></script>
  <script>
      function changeCheckCode(ths) {
          ths.src = ths.src + '?';
      };

      function csrfSafeMethod(method) {
            // these HTTP methods do not require CSRF protection
            return (/^(GET|HEAD|OPTIONS|TRACE)$/.test(method));
        }
        $.ajaxSetup({
            beforeSend: function(xhr, settings) {
                if (!csrfSafeMethod(settings.type) && !this.crossDomain) {
                    xhr.setRequestHeader("X-CSRFToken", csrftoken);
                }
            }
        });

  </script>
{% endblock %}